//
// Created by Joey on 2019/12/22.
//
#include "TerminalUtils.h"

string tipsAndInput(string tips) {
    string input;
    cout << tips << endl;
    cin >> input;
    return input;
}

void waitForContinue() {
    cout << "输入Enter继续" << endl;
    // TODO 不明白为啥要两次
    cin.get();
    cin.get();
}

void cleanConsole() {
    int code = getOSCode();
    if (code == 3 || code == 4)
    {
        system("cls");
    }
    else
    {
        system("clear");
    }
}

int getOSCode() {
    int no_os_flag = -1;

#ifdef linux
    no_os_flag = 1;
    // cout << "It is in Linux OS!" << endl;
#endif

#ifdef _UNIX
    no_os_flag = 2;
    // cout << "It is in UNIX OS!" << endl;
#endif

#ifdef __WINDOWS_
    no_os_flag = 3;
    // cout << "It is in Windows OS!" << endl;
#endif

#ifdef _WIN32
    no_os_flag = 4;
    // cout << "It is in WIN32 OS!" << endl;
#endif

    if (-1 == no_os_flag)
    {
        // cout << "No OS Defined ,I do not know what the os is!" << endl;
    }

    return no_os_flag;
}
